home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib6
/
v_08_03
/
8n03074a
< prev
next >
Wrap
Text File
|
1995-11-01
|
1KB
|
52 lines
*****Listing 2*****
--------------------------------------------------------------
/*
*
* This is the function that implements Demptser's rule
* of combination.
* vector1 & vector2 are belief vectors. vector2 will hold
* the result of the combination.
*
*/
combine_using_dempsters_rule(vector1, vector2)
float vector1[LENGTH_OF_BELIEF_VECTOR],
vector2[LENGTH_OF_BELIEF_VECTOR];
{
float denominator, sum_vector[LENGTH_OF_BELIEF_VECTOR];
int a, i, place;
/* set the sums to zero */
for(i=0; i<LENGTH_OF_BELIEF_VECTOR; i++)
sum_vector[i] = 0.0;
/* Now go through the intersection tableau.
* Look for the intersection of non-zero beliefs
* and save their products. */
for(a=1; a<LENGTH_OF_BELIEF_VECTOR; a++){
if(vector2[a] > 0.0){
for(i=0; i<LENGTH_OF_BELIEF_VECTOR; i++){
place = i & a;
if(vector1[i] > 0.0)
sum_vector[place] = (vector1[i] * vector2[a]) + sum_vector[place];
} /* ends loop over i */
} /* ends if vector2[a] > 0.0 */
} /* ends loop over a */
denominator = 1.0 - sum_vector[0];
for(i=1; i<LENGTH_OF_BELIEF_VECTOR; i++)
vector1[i] = sum_vector[i]/denominator;
} /* ends combine_using_dempsters_rule */
Figure 8 - C Code to Implement Dempster's Rule of Combination
----------------------------------------------------------------